home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0006_DAC-REGS.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  3KB  |  135 lines

  1. {
  2. Would anyone have a Procedure of Function to do a fadein or
  3. fadeout CLXXof a bitmapped image.  if I understand correctly, these
  4. CLXXfadeins are perFormed by changing the DAC Registers of the CLXXVGA
  5. Cards.  Can anyone enlighten me on this as I have CLXXsearched many
  6. books on how to do this and have not found CLXXit.  I know that there is
  7. a utility out there called CLXXFastGraph by Teg Gruber which can do
  8. this, but short of CLXXbuying it For $200.00 Would one of you good folks
  9. have a CLXXroutint in Asm or BAsm to do this. CLXXI thank you all in
  10. advance For your assistance. CLXXChristian Laferriere.
  11. }
  12.  
  13. Procedure Pageswitch(X: Byte);
  14. begin
  15.   Asm
  16.     mov ah,5
  17.     mov al,x
  18.     int 10h
  19.   end;
  20. end; { Pageswitch }
  21.  
  22. {********************************************}
  23. Procedure FadeIn;
  24.  
  25. Var
  26.   oldp,
  27.   oldp2,
  28.   oldp3       : Byte;
  29.   Palette     : Array[1..255 * 4] of Byte;
  30.   FAKEPalette : Array[1..255 * 4] of Byte;
  31.   I, J : Integer;
  32.  
  33. begin
  34.   For I := 1 to 255 do
  35.   begin
  36.     Port[$3C7] := I;
  37.     Palette[(I - 1) * 4 + 1] := I;
  38.     Palette[(I - 1) * 4 + 2] := Port[$3C9];
  39.     Palette[(I - 1) * 4 + 3] := Port[$3C9];
  40.     Palette[(I - 1) * 4 + 4] := Port[$3C9];
  41.   end;
  42.   For I := 1 to 255 do
  43.   begin
  44.     Port[$3C8] := I;
  45.     Port[$3C9] := 0;
  46.     Port[$3C9] := 0;
  47.     Port[$3C9] := 0;
  48.   end;
  49.  
  50.   Pageswitch(0);
  51.  
  52.   For J := 0 to 63 do
  53.   begin
  54.  
  55.     For I := 1 to 255 do
  56.     begin
  57.       Port[$3C7] := I;
  58.       oldp  := Port[$3C9];
  59.       oldp2 := Port[$3C9];
  60.       oldp3 := Port[$3C9];
  61.       Port[$3C8] :=I;
  62.       if oldp + 1 <= Palette[(I - 1) * 4 + 2] then
  63.         Port[$3C9] := oldp+1
  64.       else
  65.         Port[$3C9] := Oldp;
  66.       if oldp2 + 1 <= Palette[(I - 1) * 4 + 3] then
  67.         Port[$3C9] := oldp2+1
  68.       else
  69.         Port[$3C9] := Oldp2;
  70.       if oldp3 + 1 <= Palette[(I - 1) * 4 + 4] then
  71.         Port[$3C9] := oldp3+1
  72.       else
  73.         Port[$3C9] := Oldp3;
  74.     end;
  75.  
  76.     For I := 1 to 30000 do
  77.     begin
  78.     end;
  79.  
  80.   end;
  81. end; {end of FadeIn}
  82.  
  83.  
  84. Procedure FadeOut;
  85.  
  86. Var
  87.   uoldp,
  88.   uoldp2,
  89.   uoldp3  : Byte;
  90.   I, J : Integer;
  91. begin
  92.   Pageswitch(0);
  93.  
  94.   For J := 0 to 63 do
  95.   begin
  96.  
  97.     For I := 1 to 255 do
  98.     begin
  99.       Port[$3C7] := I;
  100.       uoldp  := Port[$3C9];
  101.       uoldp2 := Port[$3C9];
  102.       uoldp3 := Port[$3C9];
  103.       Port[$3C8] := I;
  104.       if uoldp - 1 >= 0 then
  105.         Port[$3C9] := uoldp - 1
  106.       else
  107.         Port[$3C9] := uOldp;
  108.       if uoldp2 - 1 >= 0 then
  109.         Port[$3C9] := uoldp2 - 1
  110.       else
  111.         Port[$3C9] := uOldp2;
  112.       if uoldp3 - 1 >= 0 then
  113.         Port[$3C9] := uoldp3 - 1
  114.       else
  115.         Port[$3C9] := uOldp3;
  116.     end;
  117.  
  118.     For I := 1 to 30000 do
  119.     begin
  120.     end;
  121.  
  122.   end;
  123. end; {end of FadeOut}
  124.  
  125. {
  126. That Procedure can FadIn and FadeOut any Text screen or any
  127. Graphics in Mode $13 With no problems.. Just make sure that you
  128. switch the video pages at the right time between fadeIns and
  129. Fadeouts.. Hope that helped.. LATER
  130. }
  131.  
  132. begin
  133.   FadeOut;
  134.   FadeIn;
  135. end.